<?php if(navigation::getAdminAction() == 'update' ): ?>
<?php
if(navigation::getAdminModeleId()>0){
    $homePage = new modele_page(navigation::getAdminModeleId());
    $data = $homePage->getDatas();
    $action = 'update';
}else{
    $homePage = new modele_page();
    $data = $homePage->getDatas();
    $action = 'create';
}
?>
<h1>Modifier/créer La page d'accueil</h1>
<hr style="margin: 5px 0 15px 0;">
<form style="margin: 12px 0;" method="post" enctype="multipart/form-data" action="?template=home&action=<?php echo $action; ?>&modele=page&do=1&modele_id=<?php echo $data['id']; ?>">
    <div class="columns ten">
        <div align="right">
            <input type="submit" value="Enregistrer" class="pwe-ui-btn"/> 
            <?php if($data['id']>0): ?><a href="<?php echo $data['url']; ?>" target="_blank" title="voir la page" class="pwe-ui-btn">voir</a><?php endif; ?>
        </div>
        <h3 style="margin: 10px 0;">Titre</h3>
        <p style="margin: 10px 0;"><input style="width: 90%;"  type="text" name="modele_title" value="<?php echo $data['title']; ?>" class="titreModele" /></p>
        <input id="permalien" type="hidden" name="modele_lien" value="accueil" />
        <h3 style="margin: 10px 0;">Texte</h3>
        <textarea class="editor" name="modele_content"><?php echo (isset($data['content']))?$data['content']:''; ?></textarea><br/>
        <p style="margin: 10px 0;">Titre SEO : <input type="text" maxlength="255" style="width: 450px;" name="modele_titre_seo" value="<?php echo $data['titre_seo']; ?>"/></p>
        <p style="margin: 10px 0;">Description SEO : <textarea  maxlength="512" name="modele_description_seo" style="height: 100px;"><?php echo $data['description_seo']; ?></textarea></p>
        
        <div align="right">
            <input type="submit" value="Enregistrer" class="pwe-ui-btn"/> 
            <?php if($data['id']>0): ?><a href="<?php echo $data['url']; ?>" target="_blank" title="voir la page" class="pwe-ui-btn">voir</a><?php endif; ?>
        </div>
        
        <?php include('../admin/include/inc/redirectionManager.inc.php'); ?>
    </div>
    <div class="columns five">
        <h3>Statut</h3>
        <select name="modele_statut_id">
            <option value="1" <?php echo($data['statut_id']=='1')?'selected="selected"':''; ?>>Brouillon</option>
            <option value="2" <?php echo($data['statut_id']=='2')?'selected="selected"':''; ?>>Publié</option>
        </select>
        <?php include('../admin/include/inc/galerieManager.inc.php'); ?>
        <br/><br/>
        <?php include('../admin/include/inc/mediaManager.inc.php'); ?>
        <input type="hidden" name="modele_category_id" value="<?php echo $data['category_id']; ?>" />
        <input type="hidden" name="modele_template" value="home" />
        <input type="hidden" name="modele_id" value="<?php echo $data['id']; ?>" />
    </div>
</form>
<?php endif ?>